feat: adding transferShieldBalance #649
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR provides the deployer of the contract the capability to transfer the balance of the shield contract to their address as requested by Polygon. This is meant to be only used in the event of an attack during which this could be used to save funds in shield contract. This will later be moved into the control of a DAO or be removed after sufficient testing on mainnet and security audit.
Only the address (called owner address here) that deploys the Shield contract can transfer the funds to itself by calling
transferShieldBalance(address ercAddress, uint256 value)
. If the value is 0, then the entire balance for that token will be transferred.Test:
nightfall-deployer/migrations/3_test_tokens_migration.js
at Line 36./start-nightfall -g -d -s
transferShieldBalance
successfully transferring entire balance to Shield contract owner's addresstransferShieldBalance
successfully transferring specific balance to Shield contract owner's addresstransferShieldBalance
failing when called by a non owner addressTest Output:
Test code: